#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int removeDuplicates(int* nums, int numsSize)
{
    int cur = 0;
    int pre = 1;
    while (pre != numsSize)
    {
        if (nums[pre] == nums[cur])
        {
            pre++;
        }
        else
        {
            cur++;
            nums[cur] = nums[pre];
            pre++;
        }
    }
    return cur + 1;
}


int main()
{
	int nums[20] = { 0 };
	int numssize = 0;
	scanf("%d\n", &numssize);
	int i = 0;
	for (i = 0; i < numssize; i++)
	{
		scanf("%d", &nums[i]);
	}
	int ret = removeDuplicates(nums,numssize);
	printf("size = %d\n", ret);
	for (i = 0; i < ret; i++)
	{
		printf("%d ", nums[i]);
	}
}